2 5. Weighted umber of late jobs 5.1. Release dates ad due dates: maximimizig the weight of o-time jobs Oce we add release dates, miimizig the umber of late jobs becomes a sigificatly harder problem. For example, we have already see (i Chapter 3) that the 3-Partitio problem ca be reduced to the problem of decidig if all jobs ca be completed by specified due dates, whe subject oly to release date costraits. Therefore, decidig if the optimal (weighted) umber of late jobs is equal to 0 is strogly NP-hard; this essetially rules out the possibility of approximatio algorithms for 1 r j w j U j (or eve 1 r j U j ). Istead, we will focus o the equivalet maximizatio problem: give release ad due dates, maximize the total weight of jobs scheduled to complete by their due date. We will give a pseudopolyomial-time algorithm that fids a schedule of objective fuctio value withi a factor of 2 of optimal, ad the show how it ca be adapted to yield, for ay ε > 0, a (2 + ε)-approximatio algorithm for this problem. The algorithm that we shall preset is a primal-dual algorithm. That is, the algorithm simultaeously computes a feasible schedule, as well as a feasible dual solutio to a liear programmig relaxatio of a atural iteger programmig formulatio to the problem; the primal ad dual objective fuctio values are withi a factor of two of each other, ad hece the schedule has total weight at least half the optimal weight. I fact, the algorithm will be preseted without explicit referece to ay iteger programmig formulatio, its liear relaxatio, or its dual. However, after the algorithm has bee fully preseted ad aalyzed we will retur to lik it to a primal-dual approach. The key mechaism i the algorithm is a techical lemma kow as the local ratio priciple. Lemma 5.1 [ Local Ratio Priciple ]. Cosider a liear optimizatio problem with objective fuctio j w j x j i decisio variables x. ecompose w = w (1) + w (2), ad cosider three related optimizatio problems (over the same class of feasible solutios), with objective fuctios give by the vectors w, w (1), ad w (2). If ˆx is a feasible solutio of objective fuctio value withi a factor ρ for both w (1) ad w (2), the it is also withi a factor of ρ for w. Proof. For simplicity of otatio, assume that the optimizatio problem is a maximizatio problem. Let x, x (1), ad x (2) be the optimal solutios with respect to w, w (1), ad w (2), respectively. We are give that Hece, w (1) ˆx w (1) x (1) /ρ ad w (2) ˆx w (2) x (2) /ρ. w ˆx = (w (1) +w (2) ) ˆx w (1) x (1) /ρ+w (2) x (2) /ρ w (1) x /ρ+w (2) x /ρ = (w (1) +w (2) )x /ρ = wx /ρ, where the secod iequality follows from the fact that x is clearly o better tha the optimal solutios to the decomposed objective fuctios w (1) ad w (2). But this is
5.1. Release dates ad due dates: maximimizig the weight of o-time jobs 3 exactly what we claimed: ˆx has objective fuctio value for w withi a factor of ρ for the w-optimal solutio. We shall preset a recursive algorithm for the geeralizatio of this problem i which there is a weight w jt associated with each o-time completio time t for job j; that is, t = r j + p j,...,d j (where we ca assume without loss of geerality that r j + p j d j, sice otherwise we could delete job j altogether). The algorithm will work i time polyomial i ad = max j d j for ay iput weights, but we will use the origial assumptios about the weights whe covertig to a polyomial-time algorithm. We shall view the algorithm as maitaiig a set S of pairs ( j,t) correspodig to those possible times t at which job j may be scheduled to complete. The algorithm is quite straightforward to state, ad it has iput cosistig of a set S with a correspodig weight vector w. Step 1 elete all pairs ( j,t) from S for which w jt 0. If S = /0, the retur /0. Step 2 Idetify the pair i S that correspods to the earliest edig poit; let ( j,t ) deote that pair. (If there is more tha oe pair with t, choose amog them arbitrarily.) Let w = w j t. Let O deote the set of pairs ( j,t) such that j j, ad schedulig j to fiish at t would overlap the processig of j to fiish at t (or equivaletly, [t p j,t) [t p j,t ) /0.) efie { w (1) w jt =, if j = j or ( j,t) O, 0, otherwise, ad let w (2) = w w (1). Step 3 Call the algorithm recursively with the curret set S ad w (2). Let F deote the set retured by the algorithm. Step 4 If ( j,t ) ca be added to the solutio F retured by the algorithm ad still be a feasible solutio, let F F {( j,t )}; otherwise, let F F. The algorithm returs F. It is easy to see iductively that the pairs output by the algorithm is a feasible selectio. We first show that ay feasible solutio is a 2-approximatio for the specially costructed objective fuctio w (1). Lemma 5.2. Cosider ay feasible selectio of itervals F. The, (i) there exists at most oe pair ( j,t) F such that j = j, ad (ii) there exists at most oe pair ( j,t) F such that ( j,t) O. Proof. The first claim is trivial, sice each job is scheduled at most oce i ay feasible schedule. For the secod part of the claim, observe that sice we have selected the iterval ( j,t ) such that t t for ay other pair i S, it follows that if ( j,t) O the the correspodig iterval [t p j,t) itersects [t p j,t ) at the time
4 5. Weighted umber of late jobs immediately precedig t. But sice F is feasible, there ca be oly oe such pair ( j,t), sice the the job j is beig processed immediately prior to t. Corollary 5.3. For the iput S cosidered i Step 2, the feasible solutio F costructed by the algorithm is of w (1) objective fuctio value withi a factor of 2 of the optimal value for w (1). Proof. Either the algorithm schedules ( j,t ) or else set F retured i Step 3 cotais a pair ( j,t) with j = j or i j O. I either case, the feasible solutio F computed by the algorithm has w (1) weight at least w (ad i fact, it is exactly w ). However, Lemma 5.2 directly implies that ay feasible solutio has weight at most 2w, ad hece the claim follows. Theorem 5.4. The recursive local ratio-based algorithm fids a feasible solutio of total weight that is at least half the optimal weight for the. give iput weights w with the give feasible selectio set S. Proof. The proof is by iductio o the umber of recursive calls of the algorithm. If there are o recursive calls, the there are o pairs i S of positive weight; hece the optimal value is 0, ad the algorithm outputs the empty set, a selectio of objective fuctio value 0. We suppose ow that the algorithm fids a solutio of objective fuctio value at least half the optimal wheever the umber of recursive calls is at most l, ad cosider a executio of the algorithm that requires l+1 recursive calls. This executio computes a set F ad a set F. By iductio, F has weight at least half the optimal value for the iput set at Step 2 for weights w (2). Sice w (2) j t = 0, the weight with respect to w (2) of F must be the same as F, ad hece is at least half the optimal value for the iput at Step 2. By Corollary 5.3, the solutio F is at least half the optimal value with respect to the weights w (1). But the, by the local ratio priciple, it is at least half the optimal value with respect to the weights w. Ad clearly, deletig possible selectios of o-positive weight does ot chage the optimal value, ad so the theorem follows. We still eed to cosider the ruig time of the algorithm. To prove a pseudopolyomial time boud is relatively straightforward. If = max j d j, the set S cotais at most pairs iitially. With each recursive call, at least oe additioal pair, that is, ( j,t ), has weight 0, ad hece is deleted i Step 1. So there are at most recursive calls, ad each ca be implemeted i O() time (updatig the weight for each active pair). There is a simple trick that coverts this algorithm to oe that rus i polyomial time. Suppose that we chage Step 1 to delete a pair ( j,t) whe its weight is less tha εw j. Now, each time job j = j, all of the pairs remaiig for job j have weight that decreases by εw j. Hece, job j is selected as j at most 1/ε times throughout all recursive calls of the algorithm, ad so there are at most /ε recursive calls overall. However, we must also boud the work eeded to maitai the weight of each active pair; if we keep this data explicitly, we will require work proportioal to, ad this
5.1. Release dates ad due dates: maximimizig the weight of o-time jobs 5 is ot polyomial. We will argue that the weights are quite simple to maitai, ad that each recursive call icreases the umber of distict weights for job j by at most 1. We will focus o the pairs active i Step 2, ad show that if we view w jt for each job j as a fuctio of t, this fuctio is a positive mootoe o-decreasig step fuctio over some iterval [r,d j ]; we will show this by iductio o the umber of recursive calls, ad further show that the umber of steps i this fuctio icreases by at most 1 with each recursive call. Suppose that after some umber of recursive calls, the weights for j are a step fuctio attaiig values with edpoits of these itervals W 1 < W 2 < < W k r = T 1 < T 2 < < T k < T k+1 = d j ; that is, the weight for ( j,t) is W l for t = T l + 1,...,T l+1. (There is the degeerate case that the weight for t = r is also W 1.) Clearly, this is true iitially, where the weight of ( j,t) is w j for t = r j + p j,...,d j. For ay pair ( j,t) with positive weight i Step 2, we kow that t t (by the choice of ( j,t )). If j = j, the effect of Step 2 is to decrease all of the values by w. Thus, the first step disappears ad i fact there is at least oe fewer step i the resultig step fuctio for this job; more steps might also disappear due to the modificatio that pairs with weight less tha εw j are deleted i Step 1. If j j, the for t such that t > t p j we subtract w from that weight w jt. But this meas that for a iitial part of the step fuctio we decrease the values of the steps. The worst-case settig is that each of the weights remais at least εw j, ad we cause oe step to be subdivided ito two. Combiig the previous two structural results, we kow that the step fuctio for each job always has at most /ε steps, ad so we ca implemet each iteratio to ru i O( 2 /ε) time, ad so the etire algorithm ca be implemeted to ru i O( 3 /ε 2 ) time. But does the modified algorithm still produce a good solultio? We use the modified algorithm to costruct a ew objective fuctio: let ŵ deote the weight fuctio such that w = ŵ except whe the pair ( j,t) is deleted due to its weight becomig less tha εw j ; i this case, set ŵ jt = w jt εw j. The crucial observatio is that if we ru the correct algorithm o ŵ, ad the modified algorithm o w, the the two executios are idetical, ad we must obtai the same result. Thus, the solutio F that is output by both algorithms has weight at least half of the optimal for ŵ. Let W deote the optimal value for the origial iput w. If we evaluate a optimal solutio for w with respect to ŵ, the we get at least (1 ε)w. Hece the optimal solutio for ŵ is at least (1 ε)w, ad the solutio foud by the algorithm has weight (with respect to ŵ) at least (1 ε)w /2. But the it must also have value with respect to w at least this much, ad we have proved the followig theorem. Theorem 5.5. For ay ε > 0, the local ratio priciple yields a (2+ε)-approximatio
6 5. Weighted umber of late jobs algorithm for 1 r j w j Ū j. Fially, we shall explai the coectio betwee this algorithm ad the otio of a primal-dual algorithm. Cosider the iteger programmig formulatio for this problem i which there is a variable x jt for each pair ( j,t) S; this is a 0-1 variable i which the value 1 idicates that job j is scheduled to complete at time t. We ca give the followig formulaatio: maximize j=1 j=1 t=1 w j x jt subject to t=1 x jt 1, for each j = 1,...,, mi{,t+p j 1} x js 1, for each t = 1,...,, s=t x jt = 0, for each j = 1,...,, t {r j + p j,...,d j } x jt {0,1} The liear programmig relaxatio of this formulatio has the followig dual liear program, where u j is the dual variable correspodig to job j for the first set of costraits, ad v t is the dual variable correspodig to time t i the secod set of costraits: miimize j=1 u j + u j + v t t=1 subject to t s=t p j +1 v s w jt, for each j = 1,...,, t = 1,...,, u j 0, for each j = 1,...,, v t 0, for each t = 1,...,. A slight modificatio of the algorithm ca be viewed as costructig a feasible dual solutio i the followig way: whe ( j,t ) is idetified, we icrease both u j ad v t by w /2. We modify the algorithm to keep track of the dual costraits ( j,t) that are already satisfied by the dual solutio (rather tha those pairs whose modified weight is o-egative). The modified algorithm is therefore guarateed to produce a feasible dual solutio. Furthermore, it is straightforward to see that i each level of recursio, the dual feasible solutio icreases i objective fuctio value, ad that w /2 of the icrease ca be viewed as partitially payig for a pair that is selected for the fial solutio; this gives a alterate way to state the essece of the 2-approximatio result.